//
//  DataManager.h
//  MSHD
//
//  Created by HCreater on 2017/12/13.
//  Copyright © 2017年 HCreater. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "TimeCaler.h"

#import "ProvincesListData.h"
#import "CategorysData.h"
#import "FilterInfosData.h"
#import "PollutantData.h"
#import "ArticleData.h"
#import "CateInfosData.h"
#import "DeclarationInfosData.h"
#import "OfflineFileDBData.h"


#import <JQFMDB/JQFMDB.h>

@interface DataManager : NSObject

MHSingletonH(DataManager);

@property (nonatomic, readwrite, assign) bool isLoadingOver;
@property (nonatomic, readwrite, assign) bool isInThirdLogin;

@property (nonatomic, readonly, strong) TimeCaler* phoneVCodeCaler;

@property (nonatomic, readwrite, strong) DeclarationInfosData* declarationInfos;
@property (nonatomic, readwrite, strong) CateInfosData* libraryCateInfos;
@property (nonatomic, readwrite, strong) CateInfosData* publicityCateInfos;
@property (nonatomic, readwrite, strong) CategorysData* categorys;
@property (nonatomic, readwrite, strong) CategorysData* enterpriseCategorys;

@property (nonatomic, readwrite, strong) FilterInfosData* filterInfos;

@property (nonatomic, readwrite, strong) NSMutableArray* pollutantDatas;
- (NSString*)parentNameFromPollutantDatas:(PollutantData*)fPollutantData withSubName:(NSString*)subName;

@property (nonatomic, readwrite, copy) NSString* address;
@property (nonatomic, readonly, strong) ProvinceListData* locationPLData;
@property (nonatomic, readwrite, strong) ProvincesListData* addrData;
- (ProvinceListData*)findCityDataBy:(NSString*)areaID;
- (ProvinceListData*)findProvinceDataBy:(ProvincesListData*)addrDatas andAreaID:(NSString*)areaID;
- (ProvinceListData*)findCityDataBy:(ProvincesListData*)addrDatas andAreaID:(NSString*)areaID;

@property (nonatomic, readwrite, copy) NSString* totalStationSearchKey;

// 环境税费计算参数
@property (nonatomic, readonly, strong) NSMutableDictionary* airValueInfo;
@property (nonatomic, readonly, strong) NSMutableDictionary* waterValueInfo;
- (NSString*)taxCalStrFromEPInfos:(NSMutableDictionary*)epInfos name:(NSString*)name;
- (CGFloat)taxCalValueFromEPInfos:(NSMutableDictionary*)epInfos name:(NSString*)name;

@property (nonatomic, readonly, strong) JQFMDB* dbMgr;

- (void)cleanDBMgr;
- (void)createDBMgr:(NSString*)dbName;
- (void)saveHistory:(ArticleData*)aData;
- (void)saveDownloadHistory:(ArticleData*)aData;
- (void)saveOfflineFileHistory:(OfflineFileDBData*)aData;

- (NSDictionary*)pushData;
- (void)savePushData:(NSDictionary*)pushData;

- (NSString*)loadingAdImgFileUrl;
- (NSString*)lastLoadingAdImgUrl;
- (NSString*)saveLoadingAdImgFileUrl;
- (void)saveLastLoadingAdImgUrl:(NSString*)adImgUrl;

@end
